package org.dolirio.soft.ui.pages;

import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.PropertyModel;
import org.dolirio.soft.model.Election;

public class RegisterElection extends BasePage {

	private Election election;

	@SuppressWarnings("unchecked")
	public RegisterElection(Election election) {

		this.election = election;

		Form form = newForm();

		form.add(new TextField("nome", new PropertyModel(election, "name")));
		form.add(new TextField("tipoEleicao", new PropertyModel(election, "electionType")));
		form.add(new TextField("candidatos", new PropertyModel(election, "candidates")));

		add(form);
	}

	@SuppressWarnings( { "unchecked", "serial" })
	private Form newForm() {
		return new Form("form") {

			@Override
			protected void onSubmit() {

				// apenas eventos
			}
		};
	}

	public Election getElection() {
		return election;
	}

	public void setElection(Election election) {
		this.election = election;
	}
}
